﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;

namespace Ordering.Service.Contract
{
	#region Object Overrides for CustomerItem

	partial class CustomerItem
	{
		/// <summary>
		/// Compares the object by its identifier.
		/// </summary>
		public override bool Equals(object obj)
		{
			CustomerItem other = (obj as CustomerItem);
			if (Object.ReferenceEquals(other, null))
				return false;
			else if (this.IsNewInstance())
				return Object.ReferenceEquals(this, other);
			else
				return true
				    && (this.Id == other.Id)
				;
		}

		/// <summary>
		/// Computes a hash code based on the objects identifier.
		/// </summary>
		public override int GetHashCode()
		{
			if (this.IsNewInstance())
				return base.GetHashCode();
			else
				return this.GetType().GetHashCode()
				     ^ this.Id.GetHashCode()
				;
		}

		/// <summary>
		/// Whether this instance is a new instance.
		/// </summary>
		public virtual bool IsNewInstance()
		{
			if (this.Id == default(System.Int32)) return true;
			return false;
		}

		/// <summary>
		/// Returns a shallow copy of this object.
		/// </summary>
		public new CustomerItem MemberwiseClone()
		{
			return (CustomerItem)base.MemberwiseClone();
		}
	}

	#endregion

	#region Object Overrides for OrderDetail

	partial class OrderDetail
	{
		/// <summary>
		/// Compares the object by its identifier.
		/// </summary>
		public override bool Equals(object obj)
		{
			OrderDetail other = (obj as OrderDetail);
			if (Object.ReferenceEquals(other, null))
				return false;
			else if (this.IsNewInstance())
				return Object.ReferenceEquals(this, other);
			else
				return true
				    && (this.OrderNumber == other.OrderNumber)
				;
		}

		/// <summary>
		/// Computes a hash code based on the objects identifier.
		/// </summary>
		public override int GetHashCode()
		{
			if (this.IsNewInstance())
				return base.GetHashCode();
			else
				return this.GetType().GetHashCode()
				     ^ this.OrderNumber.GetHashCode()
				;
		}

		/// <summary>
		/// Whether this instance is a new instance.
		/// </summary>
		public virtual bool IsNewInstance()
		{
			if (this.OrderNumber == default(System.Int32)) return true;
			return false;
		}

		/// <summary>
		/// Returns a shallow copy of this object.
		/// </summary>
		public new OrderDetail MemberwiseClone()
		{
			return (OrderDetail)base.MemberwiseClone();
		}
	}

	#endregion

	#region Object Overrides for OrderItem

	partial class OrderItem
	{
		/// <summary>
		/// Compares the object by its identifier.
		/// </summary>
		public override bool Equals(object obj)
		{
			OrderItem other = (obj as OrderItem);
			if (Object.ReferenceEquals(other, null))
				return false;
			else if (this.IsNewInstance())
				return Object.ReferenceEquals(this, other);
			else
				return true
				    && (this.OrderNumber == other.OrderNumber)
				;
		}

		/// <summary>
		/// Computes a hash code based on the objects identifier.
		/// </summary>
		public override int GetHashCode()
		{
			if (this.IsNewInstance())
				return base.GetHashCode();
			else
				return this.GetType().GetHashCode()
				     ^ this.OrderNumber.GetHashCode()
				;
		}

		/// <summary>
		/// Whether this instance is a new instance.
		/// </summary>
		public virtual bool IsNewInstance()
		{
			if (this.OrderNumber == default(System.Int32)) return true;
			return false;
		}

		/// <summary>
		/// Returns a shallow copy of this object.
		/// </summary>
		public new OrderItem MemberwiseClone()
		{
			return (OrderItem)base.MemberwiseClone();
		}
	}

	#endregion

	#region Object Overrides for OrderLineDetail

	partial class OrderLineDetail
	{
		/// <summary>
		/// Compares the object by its identifier.
		/// </summary>
		public override bool Equals(object obj)
		{
			OrderLineDetail other = (obj as OrderLineDetail);
			if (Object.ReferenceEquals(other, null))
				return false;
			else if (this.IsNewInstance())
				return Object.ReferenceEquals(this, other);
			else
				return true
				    && (this.Id == other.Id)
				;
		}

		/// <summary>
		/// Computes a hash code based on the objects identifier.
		/// </summary>
		public override int GetHashCode()
		{
			if (this.IsNewInstance())
				return base.GetHashCode();
			else
				return this.GetType().GetHashCode()
				     ^ this.Id.GetHashCode()
				;
		}

		/// <summary>
		/// Whether this instance is a new instance.
		/// </summary>
		public virtual bool IsNewInstance()
		{
			if (this.Id == default(System.Int32)) return true;
			return false;
		}

		/// <summary>
		/// Returns a shallow copy of this object.
		/// </summary>
		public new OrderLineDetail MemberwiseClone()
		{
			return (OrderLineDetail)base.MemberwiseClone();
		}
	}

	#endregion

	#region Object Overrides for ProductItem

	partial class ProductItem
	{
		/// <summary>
		/// Compares the object by its identifier.
		/// </summary>
		public override bool Equals(object obj)
		{
			ProductItem other = (obj as ProductItem);
			if (Object.ReferenceEquals(other, null))
				return false;
			else if (this.IsNewInstance())
				return Object.ReferenceEquals(this, other);
			else
				return true
				    && (this.Id == other.Id)
				;
		}

		/// <summary>
		/// Computes a hash code based on the objects identifier.
		/// </summary>
		public override int GetHashCode()
		{
			if (this.IsNewInstance())
				return base.GetHashCode();
			else
				return this.GetType().GetHashCode()
				     ^ this.Id.GetHashCode()
				;
		}

		/// <summary>
		/// Whether this instance is a new instance.
		/// </summary>
		public virtual bool IsNewInstance()
		{
			if (this.Id == default(System.Int32)) return true;
			return false;
		}

		/// <summary>
		/// Returns a shallow copy of this object.
		/// </summary>
		public new ProductItem MemberwiseClone()
		{
			return (ProductItem)base.MemberwiseClone();
		}
	}

	#endregion

}